<?php

namespace App\Jobs;

use App\Services\WxQrcodeService;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;

/**
 * 微信二维码扫码处理
 * @package App\Jobs
 */
class WxQrcodeScanHandle implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
    /**
     * 任务可以尝试的最大次数
     * @var int
     */
    public $tries = 3;
    /**
     * 超时时间
     * @var int
     */
    public $timeout = 120;

    protected $eventData;
    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($eventData)
    {
        $this->eventData = $eventData;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle(WxQrcodeService $qrcodeService)
    {
        $qrcodeService->scanHandle($this->eventData);
        return false;
    }
}
